package com.future;

import java.util.Arrays;

/**
 * Description: 561. 数组拆分
 *
 * @author weiruibai.vendor
 * Date: 2023/3/22 10:59
 */
public class Solution_561 {

    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int ans = 0;
        int N = nums.length;
        for (int i = 0; i < N / 2; i++) {
            ans += nums[i * 2];
        }
        return ans;
    }
}
